import request from '@/utils/request'



/**
 * 获取分页数据
 * @param {*} data 搜索条件
 */
export function getAllCategory() {
  return request({
    url: `/category/getAllCategory`,
    method: 'get',
  })
}


/**
 * 获取分页数据
 * @param {*} data 搜索条件
 */
export function categoryPage(data, startPage, pageSize) {
  return request({
    url: `/category/page/${startPage}/${pageSize}`,
    method: 'POST',
    data
  })
}






// ################  First   ############

/**
 * 根据id删除数据
 */
export function firstDeleteByUserId(id) {
  return request({
    url: `/category/first/del/${id}`,
    method: 'delete',
  })
}
/**
 * 添加数据
 */
export function firstAdd(data) {
  return request({
    url: `/category/first/add`,
    method: 'post',
    data: data
  })
}
/**
 * 编辑数据
 */
export function firstEdit(data) {
  return request({
    url: `/category/first/edit`,
    method: 'post',
    data: data
  })
}
// ################  First   ############






// ################  second   ############


export function secondDeleteByUserId(id) {
  return request({
    url: `/category/second/del/${id}`,
    method: 'delete',
  })
}
/**
 * 添加数据
 */
export function secondAdd(data) {
  return request({
    url: `/category/second/add`,
    method: 'post',
    data: data
  })
}
/**
 * 编辑数据
 */
export function secondEdit(data) {
  return request({
    url: `/category/second/edit`,
    method: 'post',
    data: data
  })
}
// ################  second   ############








/**
 * 批量删除多条数据
 * @param {*} ids id数组
 */
export function categoryDeleteBatch(ids) {
  return request({
    url: `/category/deleteBatch`,
    method: 'delete',
    data: ids
  })
}

/**
 * 添加一条数据
 * @param {*} data 添加的数据
 * @returns
 */
export function categoryAdd(data) {
  return request({
    url: `/category/add`,
    method: 'post',
    data
  })
}

/**
 * 根据Id查询数据
 * @param {*} id 查询的Id
 * @returns
 */
export function categoryGetById() {
  return request({
    url: `/category/getById`,
    method: 'get',
  })
}


/**
 * 修改一条数据
 * @param {*} data 修改的数据
 * @returns
 */
export function categoryEdit(data) {
  return request({
    url: `/category/edit`,
    method: 'put',
    data
  })
}
